import { combineReducers } from 'redux';

const counterReducer = (state = 0, action) => {
  switch (action.type) {
    case 'INCREMENT_COUNTER':
      return state + 1;
    default:
      return state;
  }
};

const itemsReducer = (state = [], action) => {
  switch (action.type) {
    case 'FETCH_ITEMS_SUCCESS':
      return action.payload;
    default:
      return state;
  }
};

export default combineReducers({
  counter: counterReducer,
  items: itemsReducer,
});